import { createRouter, createWebHistory } from 'vue-router'
import Home from '../views/Home.vue'

const routes = [{
        path: '/',
        name: 'Login',
        meta: {
            title: "登录"
        },
        component: () =>
            import ('../views/acount/Login.vue')
    },
    {
        path: '/register',
        name: 'Register',
        meta: {
            title: "注册"
        },
        component: () =>
            import ('../views/acount/Register.vue')
    },
    {
        path: '/forget',
        name: 'Forget',
        meta: {
            title: "忘记密码"
        },
        component: () =>
            import ('../views/acount/Forget.vue')
    },
    {
        path: '/admin',
        name: 'AdminIndex',
        meta: {
            title: "管理总台"
        },
        component: () =>
            import ('../views/layout/index.vue'),
        children: [{
            path: '/role',
            name: "Role",
            meta: {
                title: "角色管理"
            },
            component: () =>
                import ('../views/admin/role.vue')
        }, {
            path: '/user',
            name: "User",
            meta: {
                title: "用户管理"
            },
            component: () =>
                import ('../views/admin/user.vue')
        }]
    },
    {
        path: '/index',
        name: 'index',
        meta: {
            title: "首页"
        },
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.

        component: () =>
            import ( /* webpackChunkName: "about" */ '../views/layout/index.vue')
    },
    {
        path: '/new',
        name: 'New',
        meta: {
            title: "信息管理"
        },

        component: () =>
            import ('../views/news/index.vue')

    }
]

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes
})

export default router